#include "bsp_device.h"
#include "led.h"

device_state_t g_device_state;

device_state_t * get_device_state(void)
{
    return &g_device_state;
}

void set_led_state(led_number_e id,led_state_e state)
{
    g_device_state.leds[id] = state;
    if (id == LED1)
    {
        if (state == ON)
        {
            LED1_ON();
        }
        else if (state == OFF)
        {
            LED1_OFF();
        }
    }
    else if (id == LED2)    
    {
        if (state == ON)
        {
            LED2_ON();
        }
        else if (state == OFF)
        {
            LED2_OFF();
        }
    }
    
}

led_state_e get_led_state(led_number_e id)
{
    return g_device_state.leds[id];
}




void init_device_state(void)
{
    memset(&g_device_state,0,sizeof(device_state_t));
    for (uint8_t i = 0; i < LED2; i++)
    {
        g_device_state.leds[i] = OFF;
    }
}
